home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The CICA Windows Explosion!
/
The CICA Windows Explosion! - Disc 2.iso
/
demo
/
g2i12.zip
/
GRP2INI1
< prev
next >
Wrap
Text File
|
1995-01-17
|
11KB
|
209 lines
The following article appeared in the November 1994 issue of PC
Computing:
Help Column - PC Computing 11-94
By Brian Livingston
Windows users just can't get enough control over the customization
of their systems, it seems. The more they can change their
personal setup, the more they want to change it.
Personally, I think this is a good thing. Windows allows you to
customize so many things -the colors, the applications you start up
automatically with Windows, and so on - that it keeps you from
getting too serious about the work you're really supposed to be
doing on your PC.
But one of the aspects of Windows that has been quite hard to
manage is the automation of these customized features. In other
words, you may want Windows to automatically display certain icons
in Program Manager whenever you boot up your PC, but not when your
children boot it up (determined, perhaps, by which batch file they
run to start Windows). Or you may want the Program Manager to
provide a certain group window when your PC or laptop is connected
to a network, but not when it isn't connected.
Fortunately, there is now a new shareware application that can help
you automate almost any aspect of Program Manager groups. Even if
you don't use the Windows Program Manager (because you prefer some
other shell, such as Norton Desktop for Windows), this shareware
application may give you ideas about how to automate various
features of your own Windows interface.
Managing ProgMan
Before getting into the details of this shareware program, we need
to understand a little bit about how to automate the configuration
that comes up when we start Windows, and what the files are that
make this configuration possible.
The Windows Program Manager displays icons in a series of
overlapping windows called group windows. Each of these groups may
contain one or more icons, each representing a certain command
line, working directory, and icon image.
The file in which Windows stores the information about Program
Manager group windows is called PROGMAN.INI. This file is described
in the sidebar. PROGMAN.INI contains several lines that name other
files, each of which defines the contents of a different group
window. These files have the extension GRP. The Main group
window, for example, is stored in a file named MAIN.GRP. The
StartUp group file is STARTUP.GRP, and so on.
If we could control the contents of PROGMAN.INI and all these GRP
files automatically, several alternatives become possible:
* By creating two different batch files to start Windows, one for
yourself and one for your kids or co-workers, you can make a
different set of group windows appear in Program Manager, depending
on the level of trust you have in their abilities. You could make
Program Manager, for example, show only those icons that represent
games, while making invisible those icons that represent your word
processor, file manager, and so on. If you let your kids use your
PC, for example, this would allow them to click whatever they
wanted, with no concern that they would accidentally delete your
important files while playing.
* If you run a network, you can make different group windows show
up or disappear based on whether or not the PC is currently
connected to a working network. You could use a batch file that
simply looks for the existence of a common file on a network
server, and then edits the Program Manager groups based on the
results.
You can probably think of many other cases in which you'd like to
have a different configuration of Program Manager groups or icons,
depending on the status of your PC (as determined by whatever
utility programs you like to use).
The Binary-to-Text Switch
The new shareware application that gives you this kind of control
is called Group-to-Ini (GRP21NI). This unwieldy name is a
confusing label for what is really a very simple program.
GRP2INI converts any Program Manager group (.GRP) file into a plain
text file, much like WIN.INI, SYSTEM.INI, and other initialization
files that Windows reads when it starts up.
Once you have converted an unreadable GRP file into a plain text
file, you can use another shareware application, Config Control
(CFGCNTRL) to automatically edit it. This allows you to edit in
various statements - or edit out statements you don't want - based
on the findings of batch files that you use to start Windows.
Finally, after you've made the edits you want via CFGCNTRL or
manually (in a plain-text editor), you convert the text file back
into the binary format that Program Manager requires of its .GRP
files. When your batch file starts Windows, the Program Manager
obeys the new GRP files and puts up on screen just those icons and
commands that you put in your automation scripts.
It sounds complicated, but once you've gotten the hang of it,
creating different configurations on the fly can be easy and give
you a tremendous amount of flexibility.
A Tale of Two Batch Files
For the sake of illustration, let's say that you want Windows to
come up in one of two configurations. One will be for your kids,
and is started from a batch file called KIDWIN.BAT. The other is
for you and the other adults in your home or office, and is started
from a batch file called BIGWIN.BAT.
If all you want to do is make sure that the kids' configuration
shows only the Games group in the Program Manager, this can be
handled easily by Config Control alone. To make this happen, the
KIDWIN.BAT batch file would call upon Config Control to edit
PROGMAN.INI and "comment out" all references to groups other than
GAMES.GRP. That way, when Windows started up, the Program Manager
would show only the Games group window. Your other groups - Main,
StartUp, and so on - would still be in existence, but would not be
loaded by Program Manager. This makes these groups inaccessible,
so your little ones can't fire up the File Manager and delete your
C: drive, bless their hearts.
To Network or Not to Network
On the other hand, you might have a more complicated configuration
problem in mind. One common example would be establishing a
different set of icons in Program Manager depending on whether or
not your PC or laptop was connected to a network when Windows was
started.
If a network was running, you might want a certain icon in the
Network group to run a utility from the network server. If no
network was detected, you might want the same icon to launch a
different program located on the local hard disk of the PC.
This situation would require that you start Windows from a batch
file (whether AUTOEXEC.BAT or some other file) that detects whether
or not a network is running. To do this, you might insert a
command that looks for a particular file, which can only be
detected if the network is up:
IF EXIST N:\NETWORK\FILENAME.TXT GOTO NET
A command like this could lead to a :NET section of the batch file,
which would load GRP21NI to convert NETWORK.GRP into a text file.
The batch file would then use Config Control to run a series of
commands, which would revise the meaning of the icon in the Network
group that you wish to automatically configure. INI2GRP would then
convert the text file back into a GRP file. Finally, the batch
file would start Windows, and Program Manager would come up with a
Network group exactly as you had redefined it.
Using GRP21NI and CFGCNTRL
Because it is unwise to write a new GRP file while Windows is
running - and because most of the configuration changes, in Windows
should take place before Windows is started up Group-To-Ini and
Config Control are DOS command-line programs. You use them like
many other DOS utilities, by calling them from AUTOEXEC.BAT or
other batch files to operate automatically on your Windows
configuration, using whatever criteria you feel are appropriate to
branch between two or more alternative configurations.
You can download the unlicensed shareware files, G21.ZIP and
CFGCNT.ZIP, from the PC/Computing forum. Once you get them, it's
important that you peruse the documentation that accompanies these
programs. Because they are DOS character-based programs, there are
many options that are not apparent from simply running the programs
at the command line. The programs are relatively easy to learn,
but are powerful, so you'll want to know in advance how they work
on your files. Be sure to make backup copies of your CFG files
before you test these programs.
To obtain a licensed copy, send $29 for Group-To-Ini, or $69 for
both Group-To-Ini and Config Control, to TNT, P.O. Box 1791, San
Ramon, CA 94583. For credit card orders, call 510-244-5449. TNT
stands for "Tessler's Nifty Tools," a series of handy utilities
that are described in the accompanying documentation files.
If you need to automatically configure Windows on the fly, I think
you'll find that these programs give you a degree of control that
has previously been very difficult to achieve.
-Brian Livingston